<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	SoptHashMap hm = RequestManager.getRequest(request);
	SoptHashMap goods = null;
	BoardProc board = new BoardProc();
	String curCategory = "";
	
	Calendar cal = Calendar.getInstance(Locale.KOREA);
	Date date = cal.getTime();
	Date endDate = null;
	hm = board.getBoard(CommUtil.NVL(hm.get("BOARD_SEQ"),""));
	if(hm!=null && hm.get("BOARD_SEQ")!=null && hm.get("CATEGORY_SEQ").toString().equals(SoptVars.MENU_SHOP)){
		curCategory = hm.get("CATEGORY_SEQ").toString();
		AuctionProc auction = new AuctionProc();
		goods = auction.getGoodsByBoardSeq(hm.get("BOARD_SEQ").toString());
		if(goods!=null && goods.get("GOODS_AWARD_DATETIME")!=null){
			int endDateArr[] = {
				Integer.parseInt(goods.get("GOODS_AWARD_DATETIME").toString().substring(0,4))-1900,
				Integer.parseInt(goods.get("GOODS_AWARD_DATETIME").toString().substring(5,7))-1,
				Integer.parseInt(goods.get("GOODS_AWARD_DATETIME").toString().substring(8,10)),
				Integer.parseInt(goods.get("GOODS_AWARD_DATETIME").toString().substring(11,13)),
				Integer.parseInt(goods.get("GOODS_AWARD_DATETIME").toString().substring(14,16)),
				Integer.parseInt(goods.get("GOODS_AWARD_DATETIME").toString().substring(17,19))
			};
			endDate = new Date(endDateArr[0],endDateArr[1],endDateArr[2],endDateArr[3],endDateArr[4],endDateArr[5]);
		}
	}
%>    

<%@page import="styledaco.board.BoardProc"%>
<%@page import="comm.util.RequestManager"%>
<%@page import="comm.util.SoptHashMap"%>
<%@page import="comm.util.CommUtil"%>
<%@page import="statics.SoptVars"%>
<%@page import="styledaco.auction.AuctionProc"%>


<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.util.TimeZone"%>
<%@page import="java.util.Locale"%><link href="http://<%=request.getServerName()+request.getContextPath()%>/editor/css/style.css" rel="stylesheet" type="text/css" />

<%if(goods!=null){%>
<div>
	<h2>등록된 경매 상품!</h2>
	<div>
		<div><img src="<%=goods.get("GOODS_B_IMAGE")!=null?goods.get("GOODS_B_IMAGE"):""%>"></div>
		<div>상품 : <%=goods.get("GOODS_NAME")%></div>
		<div>제조사 : <%=goods.get("GOODS_COMPANY")%></div>
		<%if(date.before(endDate)){ %>
			<div>현재 입찰 수 : <%=goods.get("TENDER_COUNT") %></div>
			<div>경매 마감 일시 : <%=goods.get("GOODS_AWARD_DATETIME")%></div>
			<div><input type="button" value="입찰하기" onclick="javascript:callTenderForm('<%=goods.get("GOODS_SEQ")%>');"></div>
		<%}else{%>
			<div>마감되었습니다.</div>
		<%}%>
	</div>
</div>
<%}else if(curCategory.equals(SoptVars.MENU_SHOP)){ %>
<div>물품 등록이 되어있지 않은 게시물입니다.</div>
<%} %>
<div>
	<%if(hm!=null){ %>
		<div>제목:<%=hm.get("BOARD_TITLE") %></div>
		<div class="smartOutput">내용:<%=hm.get("BOARD_CONTENT") %></div>
		<div><%=hm.get("BOARD_REGDATETIME") %></div>
		<div><%=hm.get("MEMBER_NICK") %>(<%=hm.get("MEMBER_ID") %>)</div>
	<%} %>	
</div>

<div>
	<input type="hidden" id="curCategorySeq" value="<%=hm.get("CATEGORY_SEQ") %>">
	<ul>
	<%if(session.getAttribute("SESSION_MEMBER_SEQ")!=null ) {%>
		<li>
			<input type="button" value="답글" onclick="javascript:writeChild('<%=hm.get("CATEGORY_TYPE_NAME")%>','<%=hm.get("BOARD_SEQ").toString().equals(hm.get("PARENT_SEQ").toString())?hm.get("BOARD_SEQ"):hm.get("PARENT_SEQ") %>')">
		</li>
	<%} %>
	<%if(session.getAttribute("SESSION_MEMBER_SEQ")!=null && hm.get("MEMBER_SEQ").toString().equals(session.getAttribute("SESSION_MEMBER_SEQ").toString()) ){%>
		<li>
		<input type="button" value="수정" onclick="javascript:updateBoard('<%=hm.get("BOARD_SEQ")%>')">
		</li>
		<li>
			<form action="jsp/commons/writeProc.jsp" method="post" target="ifr" onsubmit="return confirm('해당글을 삭제하시겠습니까?');">
				<input type="hidden" name="actionType" value="deleteBoard">
				<input type="hidden" name="board_seq" value="<%=hm.get("BOARD_SEQ") %>">
				<input type="hidden" name="curMenu" value="<%=hm.get("CATEGORY_TYPE_NAME") %>">
				<input type="hidden" name="category_seq" id="write_category_seq" value="<%=hm.get("CATEGORY_SEQ") %>">
				<input type="submit" value="삭제">
			</form>
		</li>
	<%} %>
		<li>
			<input type="button" value="목록" onclick="javascript:getBoardListByJustCategory('<%=hm.get("CATEGORY_SEQ")%>','<%=hm.get("CATEGORY_TYPE_NAME")%>')">
		</li>
	</ul>
</div>

<div id="replyListLayer">
	<a href="javascript:void(0);" onclick="javascript:getReplyListByJustSeqPage('<%=hm.get("BOARD_SEQ")%>',1)">현재 댓글 수 : (<%=hm.get("REPLY_COUNT")%> )</a>
	<div id="replyListContent">
	</div>
	<div id="replyWriteLayer"></div>
</div>